package net.yvesd.cellhunter.model.coverage;

import android.location.Location;

public class SignalStrengthLocation {

	private Long id;

	private int signalStrengh;

	private Location location;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public int getSignalStrengh() {
		return signalStrengh;
	}

	public void setSignalStrengh(int signalStrengh) {
		this.signalStrengh = signalStrengh;
	}

	public Location getLocation() {
		return location;
	}

	public void setLocation(Location location) {
		this.location = location;
	}

	/**
	 * 
	 * @param other
	 * @return true if the two measurements overlap
	 */
	public boolean isOverlappingWith(SignalStrengthLocation other) {

		Location thisLocation = this.getLocation();
		Location otherLocation = other.getLocation();
		float distanceToOther = thisLocation.distanceTo(otherLocation);

		float thisAccuracy = thisLocation.getAccuracy();
		float otherAccuracy = otherLocation.getAccuracy();

		return distanceToOther < thisAccuracy + otherAccuracy;
	}

	public boolean isMoreAccurateThan(SignalStrengthLocation other) {
		return this.getLocation().getAccuracy() > other.getLocation()
				.getAccuracy();
	}
}
